﻿using MQTTnet.Server;
using System;

namespace MyMqtt
{
    sealed class MqttController
    {
        public MqttController()
        {
            // Inject other services via constructor.
        }

        public Task OnClientConnected(ClientConnectedEventArgs eventArgs)
        {
            Console.WriteLine($"Client '{eventArgs.ClientId}' connected.");
            return Task.CompletedTask;
        }


        public Task ValidateConnection(ValidatingConnectionEventArgs eventArgs)
        {
            Console.WriteLine($"Client '{eventArgs.ClientId}' wants to connect. Accepting!");
            return Task.CompletedTask;
        }
        //客户端订阅
        internal Task ClientSubscribedTopicAsync(ClientSubscribedTopicEventArgs arg)
        {

            return Task.CompletedTask;
        }
        //去掉订阅
        internal Task ClientUnsubscribedTopicAsync(ClientUnsubscribedTopicEventArgs arg)
        {
            return Task.CompletedTask;
        }
        //发布
        internal Task InterceptingPublishAsync(InterceptingPublishEventArgs arg)
        {
            return Task.CompletedTask;
        }
    }

}
